import type React from 'react';
import type { ModalProps } from 'antd';
import type { IRes } from '@/utils/request';

export type AnyObject = Record<PropertyKey, any>;

export type ModalProProps<T = any> = {
	readonly store?: { open: boolean; title: string; data: T };
	setModal: (open: boolean, title?: string, data?: T) => void;
	setUpdateFunc: (onChange: any) => void;
};

export type IProps<TParams extends any[], TData> = {
	modal: ModalProProps<TData>;
	request: (...args: [...TParams]) => Promise<IRes<TData>>;
	fetchRequest: () => [...TParams];
	content: React.ReactElement;
	extendBtns?: React.ReactElement;
	onSuccess?: (result: IRes<TData>) => void;
	onError?: () => void;
} & Omit<ModalProps, 'onOk' | 'title' | 'footer' | 'onCancel' | 'confirmLoading'>;
